package com.engine.salary.entity.salarysob.dto;

import com.engine.salary.enums.SalaryRoundingModeEnum;
import com.engine.salary.enums.SalaryValueTypeEnum;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.util.valid.DataCheck;
import com.engine.salary.util.valid.RuntimeTypeEnum;
import com.engine.salary.util.valid.ValidTypeEnum;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * 薪资账套-薪资项目表单
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author xzy
 * @version 1.0
 **/
@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class SalarySobItemFormDTO {

    //主键id")
    @JsonSerialize(using = ToStringSerializer.class)
    @DataCheck(require = true, runtime = {RuntimeTypeEnum.UPDATE}, message = "id不允许为空")
    private Long id;

    //名称")
    private String name;

    //核算时隐藏")
    @DataCheck(require = true, runtime = {RuntimeTypeEnum.UPDATE}, message = "核算时隐藏不允许为空")
    private Integer itemHide;

    //字段类型
    /**
     * @see SalaryDataTypeEnum
     */
    private String dataType;

    //舍入规则")
    /**
     * @see SalaryRoundingModeEnum
     */
    @DataCheck(require = true, runtime = {RuntimeTypeEnum.UPDATE}, message = "舍入规则不允许为空")
    private Integer roundingMode;

    //保留小数位")
    @DataCheck(require = true, type = ValidTypeEnum.NUMBER, max = 10, message = "小数位最多为10")
    private Integer pattern;

    //取值方式")
    /**
     * @see SalaryValueTypeEnum
     */
    @DataCheck(require = true, runtime = {RuntimeTypeEnum.UPDATE}, message = "取值方式不允许为空")
    private Integer valueType;

    //公式")
    private Long formulaId;

    //公式内容")
    private String formulaContent;

    // 用于前端展示 公式原始内容
    private String originFormulaContent;
    // 用于前端展示 原始sql
    private String originSqlContent;

    //备注")
    private String description;

    //是否可以编辑")
    private Integer canEdit;


    // 薪资档案引用。0：薪资档案未引用、1：薪资档案引用
    private Integer useInEmployeeSalary;

    // 默认值
    private String defaultValue;
}
